<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="box"></div>
<div id="box2"></div>
<script>
    //
    function $(id){
      //根据id找到这个元素的对象
        var obj = document.getElementById(id);
      //返回对象
        return obj
    }
    var box = $('box');
    var box2 = $('box2');
    console.log(box);
</script>
</body>
</html>